import { Injectable } from '@angular/core';
import { CanActivate, Router} from '@angular/router';

@Injectable()
export class AuthGuard implements CanActivate {
    canActivate(){
        console.log("路由守护");

        if(sessionStorage.uid){

          console.log("sessionStorage.uid=" +sessionStorage.uid);

        return true;
      }
        this.router.navigate(['login']);
        return false;
    }
    constructor(private router: Router) { }
}
